@extends('lsyouts.art')

@section('content')
<script  src="/jquery/jquery.min.js"></script>
   <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>

<div class="container-fluid">

  <form class="form-horizontal" method="POST" action="/index">

       {!! csrf_field() !!}
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">标题</label>
    <div class="col-sm-8">
      <input type="title" class="form-control" id="title" name="title">
    </div>
  </div>






  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">内容</label>
    <div class="col-sm-8">
       <textarea class="form-control" rows="5" id="content" name="content">支持markdown编写</textarea>
    </div>
  </div>
   
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-default">添加</button>
  
      <button type="button" name="but" class="btn btn-default">预览</button>
    
    </div>
  </div>
</form>

</div>





<div class="container-fluid" >

  <form class="form-horizontal" method="POST" action="/index">

      
 


  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">内容</label>
    <div class="col-sm-8" id="uu" style="widht:100px;height:100px;border:1px solid">
      
    </div>
  </div>
   
  
  <div class="form-group">
  
  </div>
</form>

</div>


<script>

	$("button[name='but']").click(function(){

		//var content =  $("textarea[name='content']").val();
	

					
			$.ajax({
			      url: '/ajxs',
			      type: "post",
			      data: {'content': $("textarea[name='content']").val(), '_token': $('input[name=_token]').val()},
			      success: function(data){
			        alert(data);
			       
			        $("#uu").html(eval(data));
			      }
			    });      




	});


</script>

@endsection